package com.qingcloud.adminbackend.enums;

/**
 * 设备编号批次状态
 */
public enum DataFunctionEnum {

    ORG(1, "按客户授权(读+写)"),
    ORDER(2, "按订单授权(读+写)"),
    ORDER_READ(3, "按订单授权(读)"),
    ADMIN(4, "部分/完全管理权限"),
    EQUIPMENT_POOL(5, "设备池"),
    CRAWLER(6, "爬虫站"),
    STATION_GROUP_MANAGE(7, "按设备组授权设备管理权限"),
    STATION_GROUP_QUERY(8, "按设备组授权数据查看权限");

    /**
     * 编号
     */
    public int code;

    /**
     * 名称
     */
    public String name;

    DataFunctionEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getNameByCode(int code) {
        DataFunctionEnum[] uss = values();
        for (DataFunctionEnum us : uss) {
            if (us.code == code) {
                return us.name;
            }
        }
        return "";
    }

    public static DataFunctionEnum getByCode(int code) {
        DataFunctionEnum[] uss = values();
        for (DataFunctionEnum us : uss) {
            if (us.code == code) {
                return us;
            }
        }
        return DataFunctionEnum.ORG;
    }
}
